/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn;

import cn.webrx.entity.Student;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ScalarHandler;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;

import java.sql.SQLException;
import java.util.Date;

/**
 * <p>Project: spring2022 - SpringDemo
 * <p>Powered by webrx On 2022-03-17 14:22:29
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@SpringJUnitConfig(locations = "classpath:applicationContext.xml")
public class SpringDemo {

    @Autowired
    Student lisi;

    @Autowired
    Date date;

    @Autowired
    ApplicationContext ctx;

    @Autowired
    QueryRunner run;


    @Test
    public void t3() {
        try{
            System.out.println(run.query("select @@version",new ScalarHandler<String>()));
        }catch(Exception e){
            e.printStackTrace();
        }
    }



    @Test
    public void t2(){
        System.out.println(lisi);
    }

    @Test
    public void t1(){
        System.out.println(lisi);
        System.out.println(date);
        //System.out.println(ctx.getBeanDefinitionNames());
        for (String n : ctx.getBeanDefinitionNames()) {
            System.out.println(n);
        }

    }
}
